var User = Backbone.Model.extend({
  defaults: {
    'fname': null,
    'lname': null,
    'role': null,
    'id': null
  },
  initialize: function() {
    // this.on({
    //   'change:fname': this.updateFname, 
    //   'change:lname': this.updateLname,
    //   'change:role': this.updateRole
    // });
    // this.updateView();
  },
  setData: function(response) {
    this.set('fname', response.fname);
    this.set('lname', response.lname);
    this.set('role', response.role);
    this.set('id', response.id);
  },
  // updateFname: function() {
  //   $('#userBar .fname').html(this.get('fname'));
  // },
  // updateLname: function() {
  //   $('#userBar .lname').html(this.get('lname'));
  // },
  // updateRole: function() {
  //   $('#userBar .fname').html(this.getRoleLabel());
  // },
  getRoleLabel: function() {
    if (this.get('role') == 1)
      var role = APP.getTrans('USERS_ROLE', 'ADMIN');
    else if (this.get('role') == 0)
      var role = APP.getTrans('USERS_ROLE', 'USER');
    return role;
  },
  isAdmin: function() {
    return (this.attributes.role == 1);
  },
  isUser: function() {
    return (this.attributes.role == 0);
  }
});